from __future__ import with_statement
import sys
from twisted.internet import protocol, reactor, defer, utils
from twisted.protocols import basic
class DataStoreProtocol(protocol.Protocol):
    def connectionMade(self):
        self.transport.write(self.factory.getDataStore())
        self.transport.loseConnection()
class DataStoreFactory(protocol.ServerFactory):
    protocol = DataStoreProtocol
    def getDataStore(self):
      with open(sys.argv[1], "r") as f:
        data = ""
        for line in f:
          data += line
        return data
reactor.listenTCP(80121, DataStoreFactory())
reactor.run()
